﻿#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESF.General;

#endregion


namespace ESF.WCF
{
	public static class WCFWindowsServiceHelper
	{
		#region Ejecucion
		
		public static void StartAsConsole<X> () where X : new ()
		{
			WindowsServiceHelper.StartAsConsole <BaseWCFWindowsService<X>> ();
		}
		
		
		public static void StartAsService<X> () where X : new ()
		{
			WindowsServiceHelper.StartAsService <BaseWCFWindowsService<X>> ();
		}


		public static void StartServiceAppSetting<X> () where X : new ()
		{
			StartServiceAppSetting<X> ("ServiceMode");
		}


		public static void StartServiceAppSetting<X> (string pServiceModeAppSettingKey) where X : new ()
		{
			switch (ReadConfig.GetAppSetting (pServiceModeAppSettingKey, "SERVICE").ToUpper ())
			{
				case "CONSOLE": 
					StartAsConsole<X> ();
				break;

				default:
					StartAsService<X> ();
				break;
			}
		}
		
		#endregion
	}
}
